{extend name="base" /}
{block name="body"}
<div class="layui-card">
    <div class="layui-card-body">
        <form action="{:request()->url()}" class="layui-form" method="post">
            {if $dict.is_level == '1'}
            <div class="layui-form-item">
                <label class="layui-form-label">上级分类</label>
                <div class="layui-input-block">
                    <select name="pid" lay-search>
                        <option value="0">一级分类</option>
                        {foreach name="category" item="v"}
                        <option value="{$v.id}" {if condition="isset($data) and $data.pid eq $v.id"}selected="selected"{/if}{if input('pid')==$v.id}selected="selected"{/if}>{neq name="v.level" value="1"}|{php}for($i=1;$i<$v['level'];$i++){echo ' ---';}{/php}{/neq} {$v.name}</option>
                        {/foreach}
                    </select>
                </div>
            </div>
            {/if}
            {if $dict.is_image == '1'}
            <div class="layui-form-item">
                <label class="layui-form-label">图片</label>
                <div class="layui-input-inline">
                    <input type="hidden" name="image" id="image-input" value="{$data.image|default=''}" autocomplete="off" placeholder="" class="layui-input">
                    <img class="layui-upload-imgs ajax-avatar" id="image-img" data-id="image" src="{$data.image|default='/static/img/no_image_100x100.jpg'}" height="150" width="150">
                </div>
                <div class="layui-form-mid layui-word-aux">建议大小(400 * 400)</div>
            </div>
            {/if}
            <div class="layui-form-item">
                <label class="layui-form-label">名称</label>
                <div class="layui-input-block">
                    <input type="text" name="name" value="{$data.name|default=''}" autocomplete="off" placeholder="请输入名称" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">描述</label>
                <div class="layui-input-block">
                    <textarea name="remark" placeholder="请输入描述" class="layui-textarea">{$data.remark|default=''}</textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-filter="i" lay-submit="">保存</button>
                    <button class="layui-btn layui-btn-primary" type="reset">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>
{/block}